package config

import "github.com/cihub/seelog"

const logConfig = "<seelog type=\"sync\">\n    <outputs formatid=\"main\">\n        <console/>\n        <rollingfile type=\"date\" filename=\"./log/mail.log\" datepattern=\"2006.01.02\" maxrolls=\"30\"/>\n    </outputs>\n    <formats>\n        <format id=\"main\" format=\"%Date %Time [%Level] %RelFile:%Line %Func %Msg%n\"/>\n    </formats>\n</seelog>"

// InitLog 初始化日志系统
func InitLog() {
	logger, err := seelog.LoggerFromConfigAsString(logConfig)
	if nil != err {
		panic("日志设置失败")
	} else {
		_ = seelog.ReplaceLogger(logger)
		defer seelog.Flush()
	}
}
